package com.tankbattle.enums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum PowerEnum {
    NO_POWER,
    CLOCK,
    LIFE,
    BOOM,
    SHIELD,
    STAR,
    STEEL_HOME;;
    // 获取所有奖励类型
    private static final List<PowerEnum> POWERS = Arrays.stream(values())
            .filter(power -> power != NO_POWER)
            .collect(Collectors.toList());

    // 随机获取一个敌方坦克类型（不会返回 PLAYER 或 PLAYER_2）
    public static PowerEnum randomPower() {
        int randomIndex = (int) (Math.random() * POWERS.size());
        return POWERS.get(randomIndex);
    }

}
